define(['app'], function(app) {
	'use strict';

	//实例化方法
	var factory = function(Http) {
		function get_data_blackList(result) {
			if(HTTP_ISLOGIC) {
				result = '{"success": true,"msg": "","result": ' +
					'{"shielding": [' +
					'{"id": "001","name": "世达","resean": "差评太多","contact_name": "张三","contact_mobile": "18912345678","brand": [' +
					'{"name": "品牌001"},' +
					'{"name": "品牌002"}],"store_cat": [' +
					'{"store_cat_name": "品类001"},' +
					'{"store_cat_name": "品类002"}]}]},' +
					'"session": "7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			} else {
				return result;
			}
		};
		function get_data_cancle(result){
			if(HTTP_ISLOGIC) {
				result = '{"success": true,"msg": "","result": {"store_id": "001"},"session": "7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			} else
				return result;
		}
		//返回信息
		return {
			//黑名单一览
			black_list: function(callback) {
				//				//post请求
				Http.post({
						method: 'member.shielding.getlist',
						session: '',
						agelimit: 8,
						nPage: 1,
						show_count: 5

					},
					function(result) {
						//请求成功
						if(callback)
							callback(get_data_blackList(result).result);
					},
					function(e) {
						//请求异常
					},
					function() {
						//请求完成，一般不做什么事情
					}
				);

			},
			cancle: function(store_id, callback) {
					Http.post({
						method: 'member.shielding.cancel',
						session: '',
						store_id: store_id
					}, function(result) {
 						if(callback)
 						callback(get_data_cancle(result));
					}, function(e) {

					}, function() {

					})
				}
				//			
		}
	};

	factory.$inject = ['Http'];
	return app.registerService("Myagent_blacklist", factory);
});